<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>套餐详情</title>
    <link rel="stylesheet" href="${base}/layui/css/layui.css">
    <link rel="stylesheet" href="${base}/awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="${base}/css/admin.css">
    <style>
    	.layui-bg-black{width: 200px;height: 136px;margin-right: 30px;float: left;text-align: center;font-size: 33px;color: #000000!important;padding-top: 30px;}
    	.hide {display: none;}
    	.checkbox{display: inline-block;}
    	.layui-form-item{font-size: 18px;}
    	.width100 {width: 100px;}
    	.discuss{ float: left;margin-left: 30px;padding-top: 6px;}
    	.discuss p{text-align: left; font-size: 13px;margin-top: 5px;padding-top: 2px;}
    	.discuss_img{ float: left;margin-left: 10px;margin-top: 5px;}
     	.img {vertical-align: top;} 
    </style>
</head>
<body  class="layui-layout-body" style="overflow:scroll;">
<#include "/common/left.flt">	
<div class="layui-main" style="position: absolute;left: 205px;top: 20px; width: calc(100% - 210px);" >
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
  <legend>详情</legend>
</fieldset>
<div class="layui-form"  style="padding-top:20px;">
   <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">套餐标题</label>
    <div class="layui-input-block">
    	<input name="title" id="title" class="layui-input" value="${one.title?default('')}"/>
    </div>
   </div>
   <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">套餐类型</label>
    <div class="layui-input-block">
    	<select name="type" id="type" class="layui-select" >
    		<option value=1>会员套餐</option>
    		<option value=2>热度套餐</option>
    	</select>
    </div>
   </div>
    <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">价格</label>
    <div class="layui-input-block">
    	<input type="number" name="price" id="price" class="layui-input" value="${one.price?default('0')}"/>
    </div>
   </div>
   <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">天数</label>
    <div class="layui-input-block">
    	<input name="days" id="days" class="layui-input" value="${one.days?default('')}"/>
    </div>
   </div>
   <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">热度</label>
    <div class="layui-input-block">
    	<input name="hot" id="hot" class="layui-input" value="${one.hot?default('0')}" />
    </div>
   </div>
    <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">赠送热度</label>
    <div class="layui-input-block">
    	<input name="zs_hot" id="zs_hot" class="layui-input" value="${one.zs_hot?default('0')}" />
    </div>
   </div>
   <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">状态</label>
    <div class="layui-input-block">
    	<select name="status" id="status" class="layui-select" >
    		<option value=1>开启</option>
    		<option value=2>禁用</option>
    	</select>
    </div>
   </div>
   <div class="layui-form-item layui-form-text">
    <label class="layui-form-label"></label>
    <div class="layui-input-inline">
	    <button class="layui-btn" id="save"><i class="fa fa-check"></i> 保存</button>
	</div>
  </div>
</div>
<form action="${base}/util/uploadFile" method="post" name="uploadForm" enctype="multipart/form-data" id="uploadForm" class="hide" >
    <input name="pic" type="file" id="pic" class="hide"/>
</form>
</body>
<script src="${base}/js/jquery-2.1.4.min.js" type="text/javascript"></script>
  <script src="${base}/js/jquery.form.js"></script>
<script src="${base}/layui/layui.all.js"></script>
<script src="${base}/laydate/laydate.js"></script>
<script type="text/javascript">
$("#type").val("${one.type?default('1')}");
$("#status").val("${one.status?default('1')}");
layui.use('form', function() {
    var form = layui.form;
    form.render('select');
});
var currentPic = null;
$('body').on('click', '.img', function () {
    currentPic = $(this);
    $("#pic").attr("accept","image/*");
    $("#pic").click();
});
$("#pic").change(function (){
    var fileName = $("#pic").val();
    var options = {
        success:  showResponse,  //处理完成的回调函数
        resetForm: true,
        //dataType:  'json'
    };
    $("#uploadForm").ajaxSubmit(options);
});

$("#save").click(function(){
	var title = $("#title").val();
	var type = $("#type").val();
	var price = $("#price").val();
	var days = $("#days").val();
	var hot = $("#hot").val();
	var zs_hot = $("#zs_hot").val();
	var status = $("#status").val();
	
	$.post("${base}/vip_package/save",
	   		{"id":${one.id?default('0')},"title":title,"type":type,"days":days,"hot":hot,"zs_hot":zs_hot,
			"status":status,"price":price},function(data){ 
	   			layer.alert(data);
	   		}
	 );	
	return;
});


</script>
</html>